package com.cnswhy.cloud.server.core.dto;


import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 描述: 购物项
 * 版权: Copyright (c) 2019
 * 公司: 小鹿科技
 * 作者: 张润泽
 * 版本: 1.0
 * 创建日期: 2019年8月27日
 * 创建时间: 下午3:17:40
 */
public class BuyerItem implements Serializable
{

    private static final long serialVersionUID = 1L;

    /**
     * 规格对象
     */
    private ShopProductSku sku = new ShopProductSku();

    /**
     * 数量
     */
    private Integer num;

    /**
     * 当前购物项运费
     */
    private BigDecimal freightPrice;

    public Integer getNum()
    {
        return num;
    }

    public void setNum(Integer num)
    {
        this.num = num;
    }

    public ShopProductSku getSku()
    {
        return sku;
    }

    public void setSku(ShopProductSku sku)
    {
        this.sku = sku;
    }

    public BigDecimal getFreightPrice()
    {
        return freightPrice;
    }

    public void setFreightPrice(BigDecimal freightPrice)
    {
        this.freightPrice = freightPrice;
    }

    @Override
    public int hashCode()
    {
        final int prime = 31;
        int result = 1;
        result = prime * result + sku.getStockId().intValue();
        return result;
    }

    @Override
    public boolean equals(Object obj)
    {
        if (this == obj) //比较地址
            return true;
        if (obj == null)
            return false;
        if (getClass() != obj.getClass())
            return false;
        BuyerItem other = (BuyerItem) obj;
        if (sku.getStockId() == null)
        {
            if (other.getSku().getStockId() != null)
                return false;
        }
        else if (!sku.getStockId().equals(other.getSku().getStockId()))
            return false;
        return true;
    }
}
